<template>
    <div class="list">
        <p class="name">《悬崖之上》张译陷绝境命悬一线</p>
        <img src="" alt="">
        <p><span>剧情/动作/悬疑</span><span>张译/于和伟/秦海璐/朱亚文</span></p>
    </div>
</template>

<script>
export default {
    name: "Films",

    data() {
        return {
            // 存放接口请求回来的电影列表数据
            films: [],
        };
    },

    // const filmList = ref([]);

    mounted() {
        // 调用 fetchData()
        this.fetchData();
    },

    methods: {

        fetchData() {
            // 请求地址
            const url = `https://m.maizuo.com/gateway?actId=ElzMZU125260`;

            fetch(url, {
                headers: {
                    "X-Host": "mall.act.static-page.info",
                },
            })
                .then((response) => response.json())
                .then((result) => {
                    // console.log(result);
                    // 判断 status （业务编码） 是否为 0
                    if (result.status === 0) {
                        // 将 result.data.films 赋值给 films
                        this.films = result.data.films;
                    } else {
                        alert(result.msg);
                    }
                });
        },
    }
}
</script>